<template>
  <div>
    标题<input type="text" v-model="title"><br>
    内容<textarea name="info" v-model="content"></textarea><br>
    <input type="button" value="发表" @click="addTheme()">
    <input type="button" value="重置" @click="reset()">
    <input type="button" value="返回" @click="back()">
  </div>
</template>

<script>
import axios from 'axios'

export default {
  data() {
    return {
      title: "",
      content: "",
    }
  },
  methods: {
    addTheme() {
      axios.get("/project/theme/add", {
        params: {
          title: this.title,
          content: this.content,
        }
      }).then(resp => {
        if (resp.data == "ok") {
          this.$router.push({name: "Theme"});
        }
      })
    },
    reset() {
      this.title = "";
      this.content = "";
    },
    back() {
      this.$router.push({name: "Theme"});
    }
  }
}

</script>

<style scoped>

</style>